package org.argeproje.resim.proc.tools;

public class Connection {
	private ProcessorNode _fromNode;
	private ProcessorNode _toNode;
	private int _fromIndex = -1;
	private int _toIndex = -1;
	public Connection(){
		
	}
	public Connection(ProcessorNode fromNode, int fromIndex,
			ProcessorNode toNode, int toIndex){
		setFromNode(fromNode);
		setFromIndex(fromIndex);
		setToNode(toNode);
		setToIndex(toIndex);
	}
	public boolean connected(){
		boolean result = (getFromNode() == null) || (getToNode() == null);
		return !result;
	}
	public void disconnect(){
		setFromNode(null);
		setToNode(null);
		setFromIndex(-1);
		setToIndex(-1);
	}
	protected void setFromNode(ProcessorNode node){
		_fromNode = node;
	}
	public ProcessorNode getFromNode(){
		return _fromNode;
	}
	public void setFromIndex(int index){
		_fromIndex = index;
	}
	public int getFromIndex(){
		return _fromIndex;
	}
	public void setToNode(ProcessorNode node){
		_toNode = node;
	}
	public ProcessorNode getToNode(){
		return _toNode;
	}
	public void setToIndex(int index){
		_toIndex = index;
	}
	public int getToIndex(){
		return _toIndex;
	}
}
